<%@ Control Language="c#" AutoEventWireup="true" CodeBehind="SharedFilesModule.ascx.cs"
    Inherits="ud_SharedFile.SharedFilesModule" %>
<portal:mojoPanel ID="mp1" runat="server" ArtisteerCssClass="art-Post" RenderArtisteerBlockContentDivs="true">
    <mp:CornerRounderTop ID="ctop1" runat="server" />
    <asp:Panel ID="pnlWrapper" runat="server" CssClass="art-Post-inner panelwrapper sharedfiles">
    <portal:ModuleTitleControlCustom ID="Title1" runat="server" RenderArtisteer="true" UseLowerCaseArtisteerClasses="true" />
        <portal:mojoPanel ID="MojoPanel1" runat="server" ArtisteerCssClass="art-PostContent">
            <div class="modulecontent">
                <asp:UpdatePanel ID="upFiles" UpdateMode="Conditional" runat="server">
                    <ContentTemplate>
                        <asp:Panel ID="pnlFile" runat="server" DefaultButton="btnUpload">
                            <table class="FileManager_table" cellspacing="0" cellpadding="0" width="99%" border="0">
                                <tr>
                                    <td class="header">
                                        <asp:ImageButton ID="btnGoUp" runat="server" OnClick="btnGoUp_Click" AlternateText=""
                                            ImageUrl="~/Data/SiteImages/btnUp.jpg" />
                                        <asp:ImageButton ID="btnDelete" runat="server" OnClick="btnDelete_Click" AlternateText="Delete"
                                            ImageUrl="~/Data/SiteImages/btnDelete.jpg" ToolTip="<%# Resources.SharedFileResources.SharedFilesDeleteButton %>" />
                                        &nbsp;&nbsp;
                                        <asp:Label ID="lblCurrentDirectory" runat="server" CssClass="foldername"></asp:Label>
                                        &nbsp;&nbsp;<asp:Label ID="lblError" runat="server" CssClass="txterror"></asp:Label>
                                    </td>
                                </tr>
                                <tr>
                                    <td class="listfile">
                                        <mp:mojoGridView ID="dgFile" runat="server" DataKeyNames="ID" EnableTheming="false"
                                            SkinID="FileManager" AllowSorting="True" OnRowCancelingEdit="dgFile_RowCancelingEdit"
                                            OnRowCommand="dgFile_RowCommand" OnRowDataBound="dgFile_RowDataBound" OnRowEditing="dgFile_RowEditing"
                                            OnRowUpdating="dgFile_RowUpdating" OnSorting="dgFile_Sorting" AutoGenerateColumns="False">
                                            <Columns>
                                                <asp:TemplateField>
                                                    <ItemTemplate>
                                                        <asp:CheckBox ID="chkChecked" runat="server" Visible='<%# IsEditable%>' />
                                                        <asp:HyperLink runat="server" Text="<%# Resources.SharedFileResources.SharedFilesEditLink %>"
                                                            ToolTip="<%# Resources.SharedFileResources.SharedFilesEditLink %>" ID="editLink"
                                                            ImageUrl='<%# this.ImageSiteRoot + "/Data/SiteImages/" + EditContentImage %>'
                                                            NavigateUrl='<%# this.SiteRoot + "/SharedFiles/Edit.aspx?pageid=" + PageId.ToString() + "&ItemID=" + DataBinder.Eval(Container.DataItem,"ID") + "&mid=" + ModuleId.ToString()  %>'
                                                            Visible="<%# IsEditable %>" /> 
                                                            <%# BuildDownloadLink(Eval("ID").ToString(),Eval("filename").ToString(), Eval("type").ToString(), true )%>
                                                    </ItemTemplate>
                                                </asp:TemplateField>
                                                <asp:TemplateField SortExpression="filename">
                                                    <ItemTemplate>
                                                        <asp:PlaceHolder ID="plhImgEdit" runat="server"></asp:PlaceHolder>
                                                        <asp:Image ID="imgType" runat="server" AlternateText=" " ImageUrl="~/Data/SiteImages/Icons/unknown.gif" />
                                                        <asp:Button ID="lnkName" runat="server" CssClass="buttonlink" Text='<%# DataBinder.Eval(Container.DataItem,"filename") %>'
                                                            CommandName="ItemClicked" CommandArgument='<%# Eval("ID") %>' CausesValidation="false"
                                                            Visible='<%# (DataBinder.Eval(Container.DataItem,"type").ToString().ToLower() != "1") %>' />
                                                            <%# BuildDownloadLink(Eval("ID").ToString(),Eval("filename").ToString(), Eval("type").ToString(), false )%>
                                                    </ItemTemplate>
                                                    <EditItemTemplate>
                                                        <asp:Panel ID="PnlRename" runat="server" DefaultButton="btnRename">
                                                            <asp:PlaceHolder ID="Placeholder1" runat="server"></asp:PlaceHolder>
                                                            <asp:Image ID="imgEditType" runat="server" ImageUrl="~/Data/SiteImages/Icons/unknown.gif" />
                                                            <asp:TextBox ID="txtEditName" runat="server" Columns="22" Text='<%# DataBinder.Eval(Container.DataItem,"filename") %>'></asp:TextBox>
                                                        </asp:Panel>
                                                    </EditItemTemplate>
                                                </asp:TemplateField>
                                                <asp:TemplateField SortExpression="Description">
                                                    <ItemTemplate>
                                                        <%# DataBinder.Eval(Container.DataItem,"Description") %>
                                                    </ItemTemplate>
                                                </asp:TemplateField>
                                                <asp:TemplateField SortExpression="size">
                                                    <ItemTemplate>
                                                        <%# DataBinder.Eval(Container.DataItem,"size") %>
                                                    </ItemTemplate>
                                                </asp:TemplateField>
                                                <asp:TemplateField SortExpression="DownloadCount">
                                                    <ItemTemplate>
                                                        <%# DataBinder.Eval(Container.DataItem, "DownloadCount")%>
                                                    </ItemTemplate>
                                                </asp:TemplateField>
                                                <asp:TemplateField SortExpression="modified">
                                                    <ItemTemplate>
                                                        <%# DateTimeHelper.GetTimeZoneAdjustedDateTimeString(((System.Data.DataRowView)Container.DataItem),"modified", TimeOffset, timeZone)%>
                                                    </ItemTemplate>
                                                </asp:TemplateField>
                                                <asp:TemplateField SortExpression="username">
                                                    <ItemTemplate>
                                                        &nbsp;&nbsp;&nbsp;<%# DataBinder.Eval(Container.DataItem, "username")%>
                                                    </ItemTemplate>
                                                </asp:TemplateField>
                                                <asp:TemplateField>
                                                    <ItemTemplate>
                                                        <asp:Button ID="LinkButton1" runat="server" Visible='<%# IsEditable%>' CssClass="buttonlink"
                                                            CommandName="Edit" CommandArgument='<%# Eval("ID") %>' CausesValidation="false"
                                                            Text="<%# Resources.SharedFileResources.FileManagerRename %>" />
                                                    </ItemTemplate>
                                                    <EditItemTemplate>
                                                        <asp:Button ID="btnRename" runat="server" CommandName="Update" CommandArgument='<%# Eval("ID") %>' 
                                                            Text="<%# Resources.SharedFileResources.SharedFilesUpdateButton %>" />&nbsp;
                                                        <asp:Button ID="LinkButton2" runat="server" CommandName="Cancel" CausesValidation="false"
                                                            Text="<%# Resources.SharedFileResources.SharedFilesCancelButton %>" />
                                                    </EditItemTemplate>
                                                </asp:TemplateField>
                                            </Columns>
                                        </mp:mojoGridView>
                                        <asp:HiddenField ID="hdnCurrentFolderId" runat="server" Value="-1" />
                                    </td>
                                </tr>
                                <tr id="trObjectCount" runat="server" class="objects">
                                    <td>
                                        <asp:Label ID="lblCounter" runat="server"></asp:Label>
                                    </td>
                                </tr>
                            </table>
                        </asp:Panel>
                        <table cellspacing="0" cellpadding="2" width="99%" border="0" id="tblNewFolder" runat="server">
                            <tr>
                                <td>
                                    <asp:Panel ID="pnlNewFolder" runat="server" DefaultButton="btnNewFolder">
                                        <asp:TextBox ID="txtNewDirectory" runat="server" Width="224px"></asp:TextBox>
                                        <portal:mojoButton ID="btnNewFolder" runat="server" Text="" OnClick="btnNewFolder_Click" />
                                    </asp:Panel>
                                </td>
                            </tr>
                        </table>
                    </ContentTemplate>
                </asp:UpdatePanel>
                <table class="fileupload" cellspacing="1" width="99%">
                    <tr>
                        <td class="fileupload">
                            <asp:Panel ID="pnlUpload" runat="server" DefaultButton="btnUpload" CssClass="settingrow uploadpanel">
                                <NeatUpload:MultiFile ID="multiFile" runat="server" UseFlashIfAvailable="true">
                                    <portal:mojoButton ID="btnAddFile" Enabled="true" runat="server" />
                                </NeatUpload:MultiFile>
                                <portal:mojoButton ID="btnUpload" runat="server" Text="Upload" OnClick="btnUpload_Click" CssClass="uploadbutton" />
                            </asp:Panel>
                        </td>
                    </tr>
                    <tr>
                        <td class="fileupload">
                            <NeatUpload:ProgressBar ID="progressBar" runat="server">
                                <mp:SiteLabel ID="progresBarLabel" runat="server" ConfigKey="CheckProgressText" />
                            </NeatUpload:ProgressBar>
                            <GreyBoxUpload:GreyBoxProgressBar ID="gbProgressBar" runat="server" GreyBoxRoot="~/ClientScript/greybox">
                                <mp:SiteLabel ID="SiteLabel1" runat="server" ConfigKey="CheckProgressText"></mp:SiteLabel>
                            </GreyBoxUpload:GreyBoxProgressBar>
                        </td>
                    </tr>
                </table>
            </div>
        </portal:mojoPanel>
        <div class="cleared">
        </div>
    </asp:Panel>
    <mp:CornerRounderBottom ID="cbottom1" runat="server" />
</portal:mojoPanel>
